package com.example.design.dahua.strategy.old;

/**
 * @author ebnew
 * 商场
 */
public class market {

    /**
     * 打折
     *
     * @param money 单价
     * @param count 数量
     * @param type  打折方式
     */
    public static void sell(int money, int count, String type) {
        double total = 0d;
        switch (type) {
            case "正常收费":
                total = money * count;
                break;
            case "打8折":
                total = money * count * 0.8;
                break;
            case "打7折":
                total = money * count * 0.7;
                break;
            case "打5折":
                total = money * count * 0.5;
                break;
            default:
                throw new RuntimeException("打折方式错误");
        }
        System.out.println("total: "+total);
    }

    public static void main(String[] args) {
        sell(10,10,"打7折");
    }
}
